package tomcat.Impl;

import tomcat.HttpServletRequest;
import tomcat.HttpServletResponse;
import tomcat.ServletException;

import java.io.IOException;
import java.io.PrintWriter;

public class HelloServlet extends HttpServletImpl{
    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        PrintWriter writer = response.getWriter();
        response.setContentType("text/html;charset=utf-8");

        String name = request.getParameter("name");
        // 响应对象 会临时保存 append 的内容
        writer.append("<h2>hello"+name+"</h2>");
        // 作业：获取参数并输出
        // http://127.0.0.1:8080/hello.do?name=zhangsan
        // hello zhangsan
        //writer.append("hello"+TomcatImpl.parameter);
    }
}
